﻿
function nextlist(){
  if (event.keyCode==40){
	 setTimeout("listdown()",500);
	  
  }
  if (event.keyCode==38){
  	
		setTimeout("listup()",500);
  }
  if(event.keyCode==36){
	 

	  OpenDiv(1370,770,'');

	  
  }
  if(event.keyCode==46){
	  	 //event.returnValue = null;
   		//window.returnValue = null;
		closeWindow();

  }
   if(event.keyCode==8){
	  	
		$('content').style.display="none"; 

  }
  if (event.keyCode==13){
	  n=li;
	  enterlist(n);
  }
}
function enterlist(n){
	
		switch(n){
			case 0:closeWindow();break;
			case 1:window.open("vip.html",'_self');break;
			case 2:window.open("ent.html",'_self');break;
			case 3:window.open("logo.html",'_self');break;
			case 4:window.open("game.html",'_self');break;
		}
	
		
        
	
}
//下
function listdown(){

	if(parseInt($('first').style.marginTop)>-431){
	$('first').style.marginTop=parseInt($('first').style.marginTop)-102+'px';
	$('first').style.height=parseInt($('first').style.height)+102+'px';
    if(li==allli){li=0;}
    slist[li+1].className="selected";
	slist[li].className="tm";
	int[li+1].style.display="";
	int[li].style.display="none";
    li = li + 1;
	}
}
//上
function listup(){
	if(parseInt($('first').style.height)>430){
		$('first').style.marginTop=parseInt($('first').style.marginTop)+102+'px';
	
		$('first').style.height=parseInt($('first').style.height)-102+'px';
	
   	 	slist[li-1].className="selected";
		int[li-1].style.display="";
	
		slist[li].className="tm";
		int[li].style.display="none";
        li = li - 1;
		
	}
}
function listMove(sli){
	
    k=sli-li;
	if(k>=0){
		
		if(parseInt($('first').style.marginTop)>-431){
			$('first').style.marginTop=parseInt($('first').style.marginTop)-k*102+'px';
			$('first').style.height=parseInt($('first').style.height)+k*102+'px';
			if(li!=-1){slist[li].className="tm";int[li].style.display="none"; }
 					slist[sli].className="selected";
					int[sli].style.display="";
		}
		
	}else{
		
		if(parseInt($('first').style.marginTop)<315){
			$('first').style.marginTop=parseInt($('first').style.marginTop)-k*102+'px';
			$('first').style.height=parseInt($('first').style.height)+k*102+'px';
			if(li!=-1){slist[li].className="tm"; int[li].style.display="none";}
			slist[sli].className="selected";
			int[sli].style.display="";
			
		}
	}
	li=sli;
	
}

var OverH,OverW,ChangeDesc,ChangeH=50,ChangeW=50;
function OpenDiv(_Dw,_Dh,_Desc) {
	 
//$("content").innerHTML="";
OverH=_Dh;OverW=_Dw;ChangeDesc=_Desc;
$("content").style.display='';
if(_Dw>_Dh){ChangeH=Math.ceil((_Dh-10)/((_Dw-10)/50))}else if(_Dw<_Dh){ChangeW=Math.ceil((_Dw-10)/((_Dh-10)/50))}
$("content").style.top=(document.documentElement.clientHeight-10)/2+"px";
$("content").style.left=(document.documentElement.clientWidth-10)/2+"px";
OpenNow()
}
var Nw=10,Nh=10;


function OpenNow() {
if (Nw>OverW-ChangeW)ChangeW=2;
if (Nh>OverH-ChangeH)ChangeH=2;
Nw=Nw+ChangeW;Nh=Nh+ChangeH;

if(OverW>Nw||OverH>Nh) {
	if(OverW>Nw) {
	$("content").style.width=Nw+"px";
	$("content").style.left=(document.documentElement.clientWidth-Nw)/2+"px";
	}
	if(OverH>Nh) {
	$("content").style.height=Nh+"px";
	$("content").style.top=(document.documentElement.clientHeight-Nh)/2+"px"
	}
	window.setTimeout("OpenNow()",10)
	}else{
	Nw=10;Nh=10;ChangeH=50;ChangeW=50;
	//$("content").innerHTML=ChangeDesc;
	}
}